package asset

import (
	"context"
	"github.com/gogf/gf/contrib/rpc/grpcx/v2"
	"grpc-common/api/user/asset"
	assetLogic "user/internal/logic/asset"
)

type AssetController struct {
	asset.UnimplementedAssetServer
}

func RegisterAssetServer(s *grpcx.GrpcServer) {
	asset.RegisterAssetServer(s.Server, &AssetController{})
}

func (*AssetController) InsertWallet(ctx context.Context, req *asset.InsertWalletReq) (res *asset.MemberWallet, err error) {
	logic := assetLogic.NewAssetLogic()
	return logic.InsertWallet(ctx, req)
}

func (*AssetController) FindWalletBySymbol(ctx context.Context, req *asset.AssetReq) (res *asset.MemberWallet, err error) {
	logic := assetLogic.NewAssetLogic()
	return logic.FindWalletBySymbol(ctx, req)
	//return nil, gerror.NewCode(gcode.CodeNotImplemented)
}

func (*AssetController) ChargeWalletBySymbol(ctx context.Context, req *asset.AssetReqBalance) (res *asset.MemberWallet, err error) {
	logic := assetLogic.NewAssetLogic()
	return logic.ChargeWalletBySymbol(ctx, req)
	//return nil, gerror.NewCode(gcode.CodeNotImplemented)
}
